!function(){
    var payarr = JSON.parse(localStorage.getItem('payarr'))
    var obj = JSON.parse(localStorage.getItem('userObj'))
    renderFun()
    function renderFun(){
        var arr = []
        for(i=0;i<payarr.length;i++){
            arr.push(
                '<div class="inventory-concent"><div class= "inventory_uname">' +
                '<img src="./img/ABUIABACGAAgiZi55gUo1sbrigQwwB840Bc!60x60.jpg">' +
                '<p class="itemname">' + payarr[i].goodsname + '</p></div><div class="inventory_pic">' +
                '<div class="fr itemtotal">￥' + payarr[i].price * payarr[i].num + '</div>' +
                '<div class="fr itemnum">' + payarr[i].num + '</div>' +
                '<div class="fr">￥' + payarr[i].price + '</div>' +
                '</div></div>'
            )
            $('#renderBox').html(arr.join(''))
            $('#paydizhi').html(obj.addrDetial)
            $('#payname').html(obj.name)
            $('#payphone').html(obj.phone)
            $('#payzhifu').html(obj.pay)
            $('#paypeisong').html(obj.peisongdir)
            $('#payliuyan').html(obj.liuyan)
        }
    }
    $('.mstlSublimeBtn').on('click',function(){
        obj.payarr = payarr
        $.ajax({
            url:'http://localhost/80edu/api.php/records/payorder',
            method:'post',
            data:{
                uid:payarr[0].uid,
                content:JSON.stringify(obj)
            },
            success:function(data){
                alert('支付成功')
                location.href = 'index.html'
            }
        })
    })
}()